package com.aletto.general_store.presenters.views;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;

import com.aletto.general_store.R;
import com.sisyphus.spinach.core.INetTask;
import com.sisyphus.spinach.core.ITask;
import com.sisyphus.spinach.network.views.ToastView;

public class ProgressView<T> extends ToastView<T> {

    private final Context context;
    private ProgressDialog progressDialog;

    public ProgressView(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public void start() {
        if (progressDialog == null || !progressDialog.isShowing()){
            progressDialog = ProgressDialog.show(context, null, context.getString(R.string.goods_upload));
        }
    }

    @Override
    public void complete() {
        if (progressDialog != null){
            progressDialog.dismiss();
        }
    }

}
